﻿Imports extranet.BE
Imports extranet.BC
Imports MetodosComuns

Partial Class forum_adm_nova_subcategoria
    Inherits System.Web.UI.Page
    Dim objBESubcategoria As BESubcategoria
    Dim strid As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim objBESeguranca As New BESeguranca
        Dim objBEUsuario As BEUsuario = Session("objBEUsuario")

        If IsNothing(objBEUsuario) Then Response.Redirect(TELA_LOGOUT)
        Session("strTela") = MetodosComuns.GetCurrentPageName()
        If Not IsPostBack Then          ' SEGURANÇA
            objBESeguranca = BCSeguranca.SelecionaPermissoes(objBEUsuario.GrupoAcesso, Session("strTela"))
            If Not objBESeguranca.Autorizado Then Response.Redirect(TELA_LOGOUT)
            Session("objBESeguranca") = objBESeguranca
        Else
            objBESeguranca = Session("objBESeguranca")
        End If
    End Sub

    Protected Sub btnGravar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGravar.Click
        objBESubcategoria = New BESubcategoria

        strid = Request.QueryString("id")
        objBESubcategoria.IdCategoria = strid
        objBESubcategoria.Nome = txtNome.Text
        If DropDownList1.SelectedIndex = 1 Then
            objBESubcategoria.Visivel = True
        Else
            objBESubcategoria.Visivel = False
        End If

        BCForum.AdicionarSubcategoria(objBESubcategoria)
        Response.Redirect("forum_inicial.aspx")
    End Sub

    Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancelar.Click
        Response.Redirect("forum_inicial.aspx")
    End Sub


End Class
